package com.jy.api.enums;

/**
 * Created by lihu on 2017/10/13.
 */
public enum PayStatusEnum {
    REFUND("REFUND", "转入退款"),
    NOTPAY("NOTPAY", "未支付"),
    CLOSED("CLOSED", "已关闭"),
    REVOKED("REVOKED", "已撤销"),
    USERPAYING("USERPAYING", "用户支付中"),
    PAYERROR("PAYERROR", "支付失败");


    /**
     * 枚举值
     */
    private final String code;

    /**
     * 枚举描述
     */
    private final String message;

    /**
     * 构造一个<code>LocalCacheEnum</code>枚举对象
     *
     * @param code
     * @param message
     */
    private PayStatusEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * @return Returns the code.
     */
    public String getCode() {
        return code;
    }

    /**
     * @return Returns the message.
     */
    public String getMessage() {
        return message;
    }

    /**
     * 通过枚举<code>code</code>获得枚举
     *
     * @param code
     * @return LocalCacheEnum
     */
    public static String getByCode(String code) {
        for (PayStatusEnum _enum : values()) {
            if (_enum.getCode().equals(code)) {
                return _enum.getMessage();
            }
        }
        return null;
    }
}
